package service

import (
	"api/app/auth/models"
	"api/libs/errs"
	sync "api/public/model-sync"
	"gitee.com/dreamwood/ez"
	"time"
)

func DealWithDepartmentInitFeed(in *sync.InitNeed) {
	curd := models.NewDepartmentCrud()
	rows, e := curd.FindBy(ez.M{}, []string{"id"}, 0, 0)
	if errs.Try(e) {
		errs.Report(e)
		return
	}
	for index, _ := range rows {
		row := rows[index]
		errs.Try(sync.GetMS().PubInitFeed(in, row))
		time.Sleep(100 * time.Microsecond)
	}
}
